<template>
    <p style="color: red">3.v-model实现父子通信:在组件中使用v-model 以input为例：等于 :modelValue='username' @update:modelValue='username='</p>
    <br>
    <p style="color: red">v-model:abc 子组件接收就应该接收abc  默认接收modelValue 也可以在组件中使用多个v-model</p>
  <input type="text" :value="modelValue" @input="handleInput" />
</template>

<script setup lang="ts" name="sqInput">
defineProps(["modelValue"]);

const emit = defineEmits(["update:modelValue"]);

const handleInput = (e: Event) => {
  console.log((e.target as HTMLInputElement).value);
  emit("update:modelValue", (e.target as HTMLInputElement).value);
};
</script>

<style scoped lang="scss"></style>
